<?php

namespace App\Transformers\StoreCoupon;

use App\Models\StoreOrderInvoice;
use League\Fractal\TransformerAbstract;

class StoreOrderInvoiceTransformer extends TransformerAbstract
{
    public function transform(StoreOrderInvoice $data){
        return [
            'id' => $data->id,
            'user_id' => $data->user_id ?? '',
            'order_id' => $data->order_id ?? '',
            'name' => $data->inamed ?? '',
            'duty_number' => $data->duty_number ?? '',
            'drawer_phone' => $data->drawer_phone ?? '',
            'email' => $data->email ?? '',
            'tell' => $data->tell ?? '',
            'address' => $data->address ?? '',
            'bank' => $data->bank ?? '',
            'card_number' => $data->card_number ?? '',
            'type' => $data->type ?? '',
            'header_type' => $data->header_type ?? '',
            'is_pay' => $data->is_pay ?? '',
            'is_refund' => $data->is_refund ?? '',
            'is_invoice'  => $data->is_invoice ?? '',
            'invoice_number' => $data->invoice_number ?? '',
            'remark' => $data->remark ?? '',
            'invoice_time' => $data->invoice_time ?? '',
            'created_at' => $data->created_at ? $data->created_at->format("Y-m-d H:i:s") : '',
            'updated_at' => $data->updated_at ? $data->updated_at->format("Y-m-d H:i:s") : '',
        ];
    }

}
